unit uniScreenItem;

interface

uses
  Classes;

type
  ItemType =
    (
    ItemHero,
    ItemEnemy,
    ItemPowerUp
    );

  { ScreenItem }

  ScreenItem = class(TObject)
  public
    pos: array[0..2] of Single;
    vel: array[0..2] of Single;

    next: ScreenItem;
    back: ScreenItem;

    age: Integer;

    screenItemType: ItemType;

    constructor Create(t: ItemType);
    destructor Destroy; override;

    procedure init; virtual;
    function getPos: PSingle; virtual;

    function ItemType: ItemType; {return screenItemType;}
  end;

var
  itemCount: Integer = 0;


implementation

{ ScreenItem }


constructor ScreenItem.Create(t: ItemType);
begin
  screenItemType := t;
  Inc(itemCount);
  init;
end;

destructor ScreenItem.Destroy;
begin
  Dec(itemCount);
  //inherited;
end;

function ScreenItem.getPos: PSingle;
begin
  Result := @pos;
end;

procedure ScreenItem.init;
begin
  pos[0] := 0.0;
  pos[1] := 0.0;
  pos[2] := 0.0;
  age := 0;
  back := nil;
  next := nil;
end;

function ScreenItem.ItemType: ItemType;
begin
  Result := screenItemType;
end;

end.

